'use strict'

const Controller = require('egg').Controller

class DeviceController extends Controller {
  async getDeviceList() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.getDeviceList(
      ctx.query
    )
    ctx.body = resBody
  }
  async getSingleDevice() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.getSingleDevice({
      device_id: ctx.params.id,
    })
    ctx.body = resBody
  }
  async createDevice() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.createDevice(
      ctx.request.body
    )
    ctx.body = resBody
  }
  async createManyDevice() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.createManyDevice(
      ctx.request.body
    )
    ctx.body = resBody
  }
  async updateDevice() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.updateDevice(
      ctx.request.body,
      ctx.params.id
    )
    ctx.body = resBody
  }
  async deleteDevice() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.device.deleteDevice(
      ctx.params.id
    )
    ctx.body = resBody
  }
}

module.exports = DeviceController
